package com.le.tester.leetcode;

/**
 * createTime：2022/6/9 16:01
 * description：排列硬币
 */
public class ArrangeCoins {


    public int arrangeCoins(int n) {

        if (n == 1) {
            return n;
        }
//        if (Integer.MAX_VALUE == n) {
//            return 65535;
//        }
        int temp = n;
        for (int i = 0; i < (long) n + 1; i++) {
            temp = temp - i;

            if (temp < 0) {
                return i - 1;
            }
        }
        return 0;
    }

    public static void main(String[] args) {
        ArrangeCoins arrangeCoins = new ArrangeCoins();
        System.out.println(arrangeCoins.arrangeCoins(2147483647));
    }
}
